Skip to content

[action] [PR:594] [Smartswitch] Restart sensord with lock#108

Merged
mssonicbld merged 1 commit intoAzure:202506from
mssonicbld:cherry/msft-202506/594
Sep 25, 2025
Merged

[action] [PR:594] [Smartswitch] Restart sensord with lock#108
mssonicbld merged 1 commit intoAzure:202506from
mssonicbld:cherry/msft-202506/594

Conversation

@mssonicbld
Copy link
Collaborator

Description

Motivation and Context

On startup of pmon in dark mode on switch, there are four processes spawned to power off DPUs, if all are executed in parallel there are four sensord processes running (since service restart commands are not queued). Since we perform handle_sensor_removal on dark mode start, the solution is to have a file lock to make sure only one module has control to restart sensord each time, queueing the sensord restart requests so that we have a single process running always, irrespective of number of restarts

How Has This Been Tested?

Check the number of sensord processes starting before fix:

docker exec -it pmon ps -x|grep sensord
    170 ?        Ss     0:00 /usr/sbin/sensord -f daemon
    171 ?        Ss     0:00 /usr/sbin/sensord -f daemon
    172 ?        Ss     0:00 /usr/sbin/sensord -f daemon
    173 ?        Ss     0:00 /usr/sbin/sensord -f daemon

after Addition of fix, only one process is found

root@sonic:/home/admin# docker exec -it pmon ps -x|grep sensord
    189 ?        Ss     0:00 /usr/sbin/sensord -f daemon

Additional Information (Optional)

<!-- Provide a general summary of your changes in the Title above -->

#### Description
<!--
     Describe your changes in detail
-->

#### Motivation and Context
<!--
     Why is this change required? What problem does it solve?
     If this pull request closes/resolves an open Issue, make sure you
     include the text "fixes #xxxx", "closes #xxxx" or "resolves #xxxx" here
-->
On startup of pmon in dark mode on switch, there are four processes spawned to power off DPUs, if all are executed in parallel there are four sensord processes running (since service restart commands are not queued). Since we perform handle_sensor_removal on dark mode start, the solution is to have a file lock to make sure only one module has control to restart sensord each time, queueing the sensord restart requests so that we have a single process running always, irrespective of number of restarts
#### How Has This Been Tested?
<!--
     Please describe in detail how you tested your changes.
     Include details of your testing environment, and the tests you ran to
     see how your change affects other areas of the code, etc.
-->
Check the number of sensord processes starting before fix:
```
docker exec -it pmon ps -x|grep sensord
    170 ?        Ss     0:00 /usr/sbin/sensord -f daemon
    171 ?        Ss     0:00 /usr/sbin/sensord -f daemon
    172 ?        Ss     0:00 /usr/sbin/sensord -f daemon
    173 ?        Ss     0:00 /usr/sbin/sensord -f daemon
```
after Addition of fix, only one process is found
```
root@sonic:/home/admin# docker exec -it pmon ps -x|grep sensord
    189 ?        Ss     0:00 /usr/sbin/sensord -f daemon
```
#### Additional Information (Optional)
@mssonicbld
Copy link
Collaborator Author

Original PR: sonic-net/sonic-platform-common#594

@mssonicbld
Copy link
Collaborator Author

/azp run

@mssonicbld mssonicbld merged commit 0c5ed14 into Azure:202506 Sep 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant